package exp03;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class B2 {
    public static void main(String[] args) {
        Map<String, Integer> map = new TreeMap<>();
        int cnt=0;
        while (cin.hasNext()) {
            String word = cin.next();
            ++cnt;
            if (!map.containsKey(word)) {
                map.put(word, 1);
            } else {
                int old = map.get(word);//
                map.put(word, old + 1);
            }
        }
        System.out.println(cnt);
        //System.err.println(map);//for debug only
        for(String key:map.keySet()){
            System.out.println(key+":"+map.get(key));
        }
       // System.out.println(map.keySet());
       // System.out.println(map.values());

    }

    static Scanner cin = new Scanner(System.in);
}
